from pages.base_page import BasePage
from selenium.webdriver.common.by import By


class BusinessEditPage(BasePage):
    url='/crm/index.php?m=business'
    origin_locator = (By.ID,'origin')
    save_edit_locator = (By.CSS_SELECTOR,'body > div.container > div.row > div > form > table > tfoot > tr > td > input.btn.btn-primary')
    save_edit_success_locator = (By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')
    business_name_locator = (By.ID,'name')
    def business_origin(self):
        return self.driver.find_element(*self.origin_locator)

    def save_edit_business(self):
        self.driver.find_element(*self.save_edit_locator).click()

    def save_edit_success(self):
        return self.driver.find_element(*self.save_edit_success_locator).text

    def clear_business_name(self):
        self.driver.find_element(*self.business_name_locator).clear()
